package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "Replacement_details", schema = "CRM", catalog = "")
public class ReplacementDetails {
    private long repId;
    private String repProductName;
    private Long repAmount;
    private Long repMoney;
    private String repCompany;
    private String repSize;
    private String repColor;
    private ExchangeGoods exchangeGoods;
    @ManyToOne
    @JoinColumn(name = "EXC_ID", referencedColumnName = "EXC_ID")
    public ExchangeGoods getExchangeGoods() {
        return exchangeGoods;
    }

    public void setExchangeGoods(ExchangeGoods exchangeGoods) {
        this.exchangeGoods = exchangeGoods;
    }

    @Id
    @Column(name = "rep_id")
    @GeneratedValue(generator = "seq",strategy = GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name = "seq",sequenceName = "crm",
            initialValue = 1,allocationSize = 1)
    public long getRepId() {
        return repId;
    }

    public void setRepId(long repId) {
        this.repId = repId;
    }

    @Basic
    @Column(name = "rep_product_name")
    public String getRepProductName() {
        return repProductName;
    }

    public void setRepProductName(String repProductName) {
        this.repProductName = repProductName;
    }

    @Basic
    @Column(name = "rep_amount")
    public Long getRepAmount() {
        return repAmount;
    }

    public void setRepAmount(Long repAmount) {
        this.repAmount = repAmount;
    }

    @Basic
    @Column(name = "rep_money")
    public Long getRepMoney() {
        return repMoney;
    }

    public void setRepMoney(Long repMoney) {
        this.repMoney = repMoney;
    }

    @Basic
    @Column(name = "rep_company")
    public String getRepCompany() {
        return repCompany;
    }

    public void setRepCompany(String repCompany) {
        this.repCompany = repCompany;
    }

    @Basic
    @Column(name = "rep_size")
    public String getRepSize() {
        return repSize;
    }

    public void setRepSize(String repSize) {
        this.repSize = repSize;
    }

    @Basic
    @Column(name = "rep_color")
    public String getRepColor() {
        return repColor;
    }

    public void setRepColor(String repColor) {
        this.repColor = repColor;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ReplacementDetails that = (ReplacementDetails) o;
        return repId == that.repId &&
                Objects.equals(repProductName, that.repProductName) &&
                Objects.equals(repAmount, that.repAmount) &&
                Objects.equals(repMoney, that.repMoney) &&
                Objects.equals(repCompany, that.repCompany) &&
                Objects.equals(repSize, that.repSize) &&
                Objects.equals(repColor, that.repColor);
    }

    @Override
    public int hashCode() {
        return Objects.hash(repId, repProductName, repAmount, repMoney, repCompany, repSize, repColor);
    }
}
